# Makefile for Dackel

include ../src/Makefile.inc

TARGETS = dackel sendpulse disc_init dfm_control

all: $(TARGETS)


dackel: main.cpp $(OBJS) $(HDRS)
	$(CXX) $(CXXFLAGS) $(LIBDIR) $(INCLUDE) -o dackel $(OBJS) main.cpp $(LIBS) 

disc_init: disc_init.cpp $(OBJS) $(HDRS)
	$(CXX) $(CXXFLAGS) $(LIBDIR) $(INCLUDE) -o disc_init $(OBJS) disc_init.cpp $(LIBS)
	        
sendpulse: sendpulse.cpp $(OBJS) $(HDRS)
	$(CXX) $(CXXFLAGS) $(LIBDIR) $(INCLUDE) -o sendpulse $(OBJS) sendpulse.cpp $(LIBS) 

dfm_control: dfm_control.cpp LogicPool/LogicInterfaceUSB.o LogicPool/logicbox.o LogicPool/DFM.o Profile.o inifile.o teebuf.o
	$(CXX) $(CXXFLAGS) $(INCLUDE) -o $@ $^


dkl2root: dkl2root.cpp dkl/DklHeader.o dkl/EventStruct.h dkl/EventStructVer1.h config.h
	$(CC) -o dkl2root $(CFLAGS) $(INCLUDE) dkl2root.cpp dkl/DklHeader.o -lz $(shell root-config --libs --cflags)

bin: bin.cpp
	$(CXX) $(CXXFLAGS) -o bin bin.cpp	

hist:	hist.cpp
	$(CXX) $(CXXFLAGS) -o hist hist.cpp


clean:
	-rm *.o LogicPool/*.o hw/*.o dkl/*.o
	-rm $(TARGETS)

install: install-dkl2root

install-dkl2root: dkl2root
	chown perkeo:users dkl2root
	chmod g-w,o-w dkl2root
	cp dkl2root /usr/local/bin
	
install-dackel:
	chown knecht:users dackel
	chmod u+s,g+s,g-w,o-w dackel
	cp dackel /usr/local/bin
#	cp dackel.cfg /etc
